import LocalStorageKey from '@/constant/LocalStorageKey'
import ISocketRegForm from '@/model/form/socket/ISocketRegForm'
import IResVO from '@/model/vo/common/IResVO'
import ISocketRegVO from '@/model/vo/socket/ISocketRegVO'
import $http from '@/util/http'
import { AxiosResponse } from 'axios'

// 获取 socket连接地址
export default function socketRegApi(
  form: ISocketRegForm = {
    value: localStorage.getItem(LocalStorageKey.SOCKET_TYPE) || '1',
  }
) {
  return $http.post<
    IResVO,
    AxiosResponse<IResVO<ISocketRegVO>>,
    ISocketRegForm
  >('/socket/reg', form, {
    timeout: 2000,
    headers: {
      hiddenErrorMsg: true, // 隐藏接口请求报错提示
    },
  })
}
